<template>
  <div>
     <!-- ------------------列表------------------ -->
    <el-table :data="companyAccountFundsList" border style="width: 100%">
      <el-table-column prop="companyAccountFundsId" label="ID" width="180"></el-table-column>
      <el-table-column prop="companyAccountFundsNo" label="银行账户" width="180">
      </el-table-column>
      <el-table-column prop="bankName" label="银行ID"> </el-table-column>
      <el-table-column prop="companyAccountFundsUser" label="开户人"> </el-table-column>
      <el-table-column prop="companyAccountFundsCreateTime" label="开户时间"> </el-table-column>
      <el-table-column prop="companyAccountFundsActualAmount" label="实际资金"> </el-table-column>
      <el-table-column prop="companyStreamType" label="转入转出类型"> </el-table-column>
      <el-table-column prop="companyStreamTime" label="时间"> </el-table-column>
      <el-table-column prop="companyStreamMoney" label="金额"> </el-table-column>
      <el-table-column prop="companyAccountFundsDesc" label="备注"> </el-table-column>
       <!-- <template slot-scope="scope">
          <el-button size="mini" @click="Push(scope.row.companyAccountFundsId)"
            >推送</el-button
          >
        </template> -->
           <el-table-column label="操作" width="280">
        <template slot-scope="scope">
          
          <el-button size="mini" @click="push(scope.row.companyAccountFundsId) " 
            >推送</el-button
          >
          
          
        </template>
      </el-table-column>
    </el-table>
    <!----------------------------添加----------------- -- -->
    <el-dialog title="添加信息" :visible.sync="dialog.addDialogFormVisible" width="30%">
      <el-form :model="addForm">
        
       <el-form-item label="银行账户" prop="companyAccountFundsNo" >
              <el-input v-model="addForm.companyAccountFundsNo" ></el-input>
            </el-form-item>
            <el-form-item label="银行ID" prop="bankName">
              <el-input v-model="addForm.bankName"></el-input>
            </el-form-item>
            <el-form-item label="开户人" prop="companyAccountFundsUser">
              <el-input v-model="addForm.companyAccountFundsUser"></el-input>
            </el-form-item>
            <!-- <el-form-item label="开户时间" prop="companyAccountFundsCreateTime">
              <el-input v-model="addForm.companyAccountFundsCreateTime"></el-input>
            </el-form-item> -->
             <el-form-item label="开户时间">
          <el-date-picker
            v-model="addForm.companyAccountFundsCreateTime"
            type="date"
            placeholder="选择日期"
          >
          </el-date-picker>
        </el-form-item>
            <el-form-item label="实际资金" prop="companyAccountFundsActualAmount">
              <el-input v-model="addForm.companyAccountFundsActualAmount"></el-input>
            </el-form-item>
            <el-form-item label="转入转出类型" prop="companyStreamType">
              <el-input v-model="addForm.companyStreamType"></el-input>
            </el-form-item>
              <el-form-item label="时间">
          <el-date-picker
            v-model="addForm.companyStreamTime"
            type="date"
            placeholder="选择日期"
          >
          </el-date-picker>
        </el-form-item>
             <el-form-item label="金额" prop="companyStreamMoney">
              <el-input v-model="addForm.companyStreamMoney"></el-input>
            </el-form-item>
             <el-form-item label="备注" prop="companyAccountFundsDesc">
              <el-input v-model="addForm.companyAccountFundsDesc"></el-input>
            </el-form-item>


      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialog.addDialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="add">确 定</el-button>
      </div>
    </el-dialog>
    <el-button type="success" @click="dialog.addDialogFormVisible = true"
            >新建</el-button
          >
  </div>
</template>

<script>
export default {
  data() {
    return {
        companyAccountFundsList:[],
        addForm:{},
        dialog: {
        addDialogFormVisible: false,
      },
    };
  },
  methods: {
    push (companyAccountFundsId) {
      this.$axios.get("Comanys/" + companyAccountFundsId).then((res) => {
        if (res.data.code == 200) {
          this.$message.success("添加成功");
        }
      });
    },
     loadRefound() {
      this.$axios.get("company/quereyAll").then((res) => {
        this.companyAccountFundsList = res.data.data.companyAccountFundsList;
      });
    },
       add(){
      this.$axios.post("company",this.addForm)
      .then(res=>{
        if(res.data.code==200){
          this.$message.success("添加成功");
          this.dialog.addDialogFormVisible = false;//关闭模态框
          this.loadRefound();//刷新
        }
      })

    },
  },
  mounted() {
    this.loadRefound();
  }
};
</script>
